package com.lovo.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.web.bean.UserInfoBean;
import com.lovo.web.mapper.IUserInfoMapper;
import com.lovo.web.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class UserInfoServiceImpl implements IUserInfoService {
    @Autowired
    private IUserInfoMapper infoMapper;

    @Override
    public UserInfoBean findUserInfo(Long userId) {
        QueryWrapper<UserInfoBean> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("fk_userId", userId);
        QueryWrapper<UserInfoBean> sort=queryWrapper.orderByDesc("pk_uiId").last("limit 1");
        return infoMapper.selectOne(sort);
    }
}
